<%--
  Created by IntelliJ IDEA.
  User: yanl_
  Date: 2017/11/18
  Time: 0:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
    <script>
        $(document).ready(function () {
            // alert("OK TEST............");

            $('#tel-list').on(
                    'keyup mouseout input',
                    function () {
                        var $this = $(this), v = $this.val().trim();
                        $this.val(v.replace(/[^0-9,]/g, '').replace(/[,]{1,}/g,',').replace(/^,/,'')  );//使用空白替换非数字
                        $this.val($("#tel-list").val().trim()
                             //   .replace(/([0-9]{11})/g, "$1 ")
                        ); //暂时添加4个空格
                    });
        });

    </script>
</head>
<body>

<input id="tel-list" type="text" value=""> this is a test.jsp

</body>
</html>
